{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "# import os\n",
    "# os.environ[\"KMP_DUPLICATE_LIB_OK\"]=\"TRUE\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "tensor([[0., 0., 0., 0.],\n",
      "        [0., 0., 0., 0.],\n",
      "        [0., 0., 0., 0.]])\n",
      "tensor([3, 4])\n",
      "torch.FloatTensor\n",
      "torch.LongTensor\n"
     ]
    }
   ],
   "source": [
    "import torch \n",
    "x = torch.Tensor(3,4)       #直接生成3行4列的FloatTensor\n",
    "y = torch.tensor([3,4])     #根据数据类型生成Tensor因此需要具体数据\n",
    "# y = torch.Tensor(3,4)      #是不行的\n",
    "print(x)\n",
    "print(y)\n",
    "print(x.type())\n",
    "print(y.type())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "predict (after training) 4 7.999998569488525\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXgAAAEGCAYAAABvtY4XAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuNCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8QVMy6AAAACXBIWXMAAAsTAAALEwEAmpwYAAAWUElEQVR4nO3dfYzdV53f8fd35l7PHTseTx5mg2M7OLA0DUuJE6YsabosJSwFdkWoeEhoQylFstrSblKhbonYVbWr/lGpLYJKW4oVYLMlDQ8h2UURhOxml7CRIMk4OCGPPISEOHHigeCHJPZ4PP72j/ub8dgZJ2PP/OZ6zu/9kkae+zD3nCPbHx9/f+d3TmQmkqTy9PW6A5KkehjwklQoA16SCmXAS1KhDHhJKlSr1x2Y7YwzzsiNGzf2uhuStGxs3br1F5k5MtdrJ1XAb9y4kbGxsV53Q5K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feAb8zB3hERdGuyD2Xmp2a99A3gw9X3Hwb+cqn7VpfMvDoz12fmRrq/t3+TmVdQ8JgBMvNp4ImIOLd66hLgQcoe98+BN0XEyurP+iV0rzOVPObZjjXObwCXR8RARJwDvAa4a96fmpnL+gt4F/Aj4KfAJ3vdnxrH+Y/p/tfsPmBb9fUu4HS6V91/XP16Wq/7WtP43wLcXH1f/JiBTcBY9fv9F8CppY8b+GPgYeB+4P8CAyWOGbie7nWGSboz9I++1DiBT1b59gjwzuNpy60KJKlQy71EI0k6BgNekgplwEtSoQx4SSqUAS9JhTLgpUUQEW+Z3u1SOlkY8JJUKANejRIRV0TEXRGxLSI+V+01/1xE/M+IuCcibouIkeq9myLi+xFxX0TcNL1Hd0T8ekT8dUTcW/3Mq6uPP2XWHu7XVXdkSj1jwKsxIuI84DLg4szcBEwB/wJYBdyTmRcCtwP/pfqRPwf+c2a+HvjhrOevA/40M8+nu1/Kjur5C4Cr6J5N8Cq6e+lIPdPqdQekJXQJ8Abg7mpyPUh3U6dDwFeq93wJuDEi1gDDmXl79fy1wNciYjWwLjNvAsjM/QDV592Vmdurx9uAjcAdtY9KOgYDXk0SwLWZefURT0b80VHve6n9O16q7DIx6/sp/PulHrNEoya5DXhfRPwazJyD+Uq6fw/eV73nnwN3ZOZu4FcR8VvV8x8Cbs/uHvzbI+I91WcMRMTKpRyENF/OMNQYmflgRPwhcGtE9NHdze9jdA/U+I2I2Arsplunh+62rf+nCvBHgY9Uz38I+FxE/En1Ge9fwmFI8+Zukmq8iHguM0/pdT+kxWaJRpIK5QxekgrlDF6SCmXAS1KhDHhJKpQBL0mFMuAlqVD/H6qWzJEkZ10TAAAAAElFTkSuQmCC",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "import torch\n",
    "import matplotlib.pyplot as plt\n",
    "\n",
    "\n",
    "x_data = [1.0, 2.0, 3.0]\n",
    "y_data = [2.0, 4.0, 6.0]\n",
    "alpha = 0.01\n",
    "w = torch.Tensor([1.0])\n",
    "w.requires_grad = True  # 需要计算梯度\n",
    "\n",
    "\n",
    "def forward(x_val):\n",
    "    return x_val * w\n",
    "\n",
    "\n",
    "def loss(x_val, y_val):\n",
    "    y_hat = forward(x_val)\n",
    "    return (y_hat - y_val) ** 2\n",
    "\n",
    "\n",
    "epoch_list = []\n",
    "cost_list = []\n",
    "for epoch in range(100):\n",
    "    # 随机梯度下降\n",
    "    for x, y in zip(x_data, y_data):\n",
    "        l = loss(x, y)\n",
    "        l.backward()\n",
    "        # print('\\t grad:', x, y, w.grad.item())\n",
    "        w.data = w.data - alpha * w.grad.data\n",
    "        w.grad.data.zero_()\n",
    "    epoch_list.append(epoch)\n",
    "    cost_list.append(l.item())\n",
    "    # print('progress:', epoch, l.item())  # 取出loss使用l.item，不要直接使用l（l是tensor会构建计算图）\n",
    "print(\"predict (after training)\", 4, forward(4).item())\n",
    "plt.plot(epoch_list, cost_list)\n",
    "plt.ylabel('loss')\n",
    "plt.xlabel('epoch')\n",
    "plt.show()\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "progress: 0 18.321826934814453\n",
      "progress: 1 2.858394145965576\n",
      "progress: 2 1.1675907373428345\n",
      "progress: 3 0.04653334245085716\n",
      "progress: 4 0.14506366848945618\n",
      "progress: 5 0.009403289295732975\n",
      "progress: 6 0.04972923547029495\n",
      "progress: 7 0.025129113346338272\n",
      "progress: 8 0.03345605731010437\n",
      "progress: 9 0.027609655633568764\n",
      "progress: 10 0.02848036028444767\n",
      "progress: 11 0.02642466314136982\n",
      "progress: 12 0.025804826989769936\n",
      "progress: 13 0.02462013065814972\n",
      "progress: 14 0.023777369409799576\n",
      "progress: 15 0.0228563379496336\n",
      "progress: 16 0.022044027224183083\n",
      "progress: 17 0.02125072106719017\n",
      "progress: 18 0.020513182505965233\n",
      "progress: 19 0.019810274243354797\n",
      "progress: 20 0.019148115068674088\n",
      "progress: 21 0.018520694226026535\n",
      "progress: 22 0.017927465960383415\n",
      "progress: 23 0.01736525259912014\n",
      "progress: 24 0.016833148896694183\n",
      "progress: 25 0.01632905937731266\n",
      "progress: 26 0.01585075818002224\n",
      "progress: 27 0.015397666022181511\n",
      "progress: 28 0.014967591501772404\n",
      "progress: 29 0.014559715054929256\n",
      "progress: 30 0.014172340743243694\n",
      "progress: 31 0.013804304413497448\n",
      "progress: 32 0.013455045409500599\n",
      "progress: 33 0.013122711330652237\n",
      "progress: 34 0.01280694268643856\n",
      "progress: 35 0.012506747618317604\n",
      "progress: 36 0.012220758944749832\n",
      "progress: 37 0.01194891706109047\n",
      "progress: 38 0.011689926497638226\n",
      "progress: 39 0.01144315768033266\n",
      "progress: 40 0.011208509095013142\n",
      "progress: 41 0.0109840864315629\n",
      "progress: 42 0.010770938359200954\n",
      "progress: 43 0.010566935874521732\n",
      "progress: 44 0.010372749529778957\n",
      "progress: 45 0.010187389329075813\n",
      "progress: 46 0.010010283440351486\n",
      "progress: 47 0.00984097272157669\n",
      "progress: 48 0.009679674170911312\n",
      "progress: 49 0.009525291621685028\n",
      "progress: 50 0.00937769003212452\n",
      "progress: 51 0.009236648678779602\n",
      "progress: 52 0.00910158734768629\n",
      "progress: 53 0.00897257961332798\n",
      "progress: 54 0.008848887868225574\n",
      "progress: 55 0.008730598725378513\n",
      "progress: 56 0.00861735362559557\n",
      "progress: 57 0.008508718572556973\n",
      "progress: 58 0.008404706604778767\n",
      "progress: 59 0.008305158466100693\n",
      "progress: 60 0.00820931326597929\n",
      "progress: 61 0.008117804303765297\n",
      "progress: 62 0.008029798977077007\n",
      "progress: 63 0.007945418357849121\n",
      "progress: 64 0.007864190265536308\n",
      "progress: 65 0.007786744274199009\n",
      "progress: 66 0.007711691781878471\n",
      "progress: 67 0.007640169933438301\n",
      "progress: 68 0.007570972666144371\n",
      "progress: 69 0.007504733745008707\n",
      "progress: 70 0.007440924644470215\n",
      "progress: 71 0.007379599846899509\n",
      "progress: 72 0.007320486940443516\n",
      "progress: 73 0.007263725157827139\n",
      "progress: 74 0.007209045812487602\n",
      "progress: 75 0.007156429346650839\n",
      "progress: 76 0.007105532102286816\n",
      "progress: 77 0.00705681974068284\n",
      "progress: 78 0.007009552326053381\n",
      "progress: 79 0.006964194122701883\n",
      "progress: 80 0.006920332089066505\n",
      "progress: 81 0.006878111511468887\n",
      "progress: 82 0.006837360095232725\n",
      "progress: 83 0.006797831039875746\n",
      "progress: 84 0.006760062649846077\n",
      "progress: 85 0.006723103579133749\n",
      "progress: 86 0.00668772729113698\n",
      "progress: 87 0.006653300020843744\n",
      "progress: 88 0.0066203586757183075\n",
      "progress: 89 0.0065881176851689816\n",
      "progress: 90 0.0065572685562074184\n",
      "progress: 91 0.0065271081402897835\n",
      "progress: 92 0.00649801641702652\n",
      "progress: 93 0.0064699104987084866\n",
      "progress: 94 0.006442630663514137\n",
      "progress: 95 0.006416172254830599\n",
      "progress: 96 0.006390606984496117\n",
      "progress: 97 0.0063657015562057495\n",
      "progress: 98 0.0063416799530386925\n",
      "progress: 99 0.00631808303296566\n",
      "progress: 100 0.00629558926448226\n",
      "progress: 101 0.006273437757045031\n",
      "progress: 102 0.0062520792707800865\n",
      "progress: 103 0.006231133826076984\n",
      "progress: 104 0.006210974883288145\n",
      "progress: 105 0.006191148888319731\n",
      "progress: 106 0.006172103341668844\n",
      "progress: 107 0.006153387017548084\n",
      "progress: 108 0.006135221570730209\n",
      "progress: 109 0.00611760513857007\n",
      "progress: 110 0.006100163329392672\n",
      "progress: 111 0.006083489861339331\n",
      "progress: 112 0.006067062262445688\n",
      "progress: 113 0.0060510276816785336\n",
      "progress: 114 0.006035459227859974\n",
      "progress: 115 0.006020206492394209\n",
      "progress: 116 0.006005268543958664\n",
      "progress: 117 0.005990718491375446\n",
      "progress: 118 0.005976480431854725\n",
      "progress: 119 0.0059625543653965\n",
      "progress: 120 0.005948938895016909\n",
      "progress: 121 0.00593563262373209\n",
      "progress: 122 0.005922487936913967\n",
      "progress: 123 0.005909724626690149\n",
      "progress: 124 0.005897194612771273\n",
      "progress: 125 0.005884970538318157\n",
      "progress: 126 0.005872978363186121\n",
      "progress: 127 0.005861071869730949\n",
      "progress: 128 0.0058495416305959225\n",
      "progress: 129 0.005837949924170971\n",
      "progress: 130 0.005826952401548624\n",
      "progress: 131 0.005815965123474598\n",
      "progress: 132 0.005805060733109713\n",
      "progress: 133 0.005794601980596781\n",
      "progress: 134 0.00578386289998889\n",
      "progress: 135 0.00577378598973155\n",
      "progress: 136 0.00576357264071703\n",
      "progress: 137 0.0057536582462489605\n",
      "progress: 138 0.005743823945522308\n",
      "progress: 139 0.005734143313020468\n",
      "progress: 140 0.005724542308598757\n",
      "progress: 141 0.005715165752917528\n",
      "progress: 142 0.0057058692909777164\n",
      "progress: 143 0.005696651991456747\n",
      "progress: 144 0.005687730386853218\n",
      "progress: 145 0.005678671412169933\n",
      "progress: 146 0.005669835489243269\n",
      "progress: 147 0.005661221221089363\n",
      "progress: 148 0.005652470514178276\n",
      "progress: 149 0.005644013173878193\n",
      "progress: 150 0.005635562352836132\n",
      "progress: 151 0.00562726054340601\n",
      "progress: 152 0.005618964787572622\n",
      "progress: 153 0.005610818043351173\n",
      "progress: 154 0.005602677818387747\n",
      "progress: 155 0.005594756919890642\n",
      "progress: 156 0.005586770363152027\n",
      "progress: 157 0.005578860640525818\n",
      "progress: 158 0.005571170710027218\n",
      "progress: 159 0.005563272163271904\n",
      "progress: 160 0.00555587699636817\n",
      "progress: 161 0.005548060405999422\n",
      "progress: 162 0.0055406042374670506\n",
      "progress: 163 0.005533081945031881\n",
      "progress: 164 0.005525777582079172\n",
      "progress: 165 0.005518265534192324\n",
      "progress: 166 0.005510971415787935\n",
      "progress: 167 0.005503752268850803\n",
      "progress: 168 0.005496538244187832\n",
      "progress: 169 0.0054893288761377335\n",
      "progress: 170 0.005482194479554892\n",
      "progress: 171 0.005475135520100594\n",
      "progress: 172 0.005468081217259169\n",
      "progress: 173 0.005461101885885\n",
      "progress: 174 0.005454127211123705\n",
      "progress: 175 0.005447227042168379\n",
      "progress: 176 0.005440261214971542\n",
      "progress: 177 0.005433651152998209\n",
      "progress: 178 0.005426623392850161\n",
      "progress: 179 0.005419951397925615\n",
      "progress: 180 0.005413143429905176\n",
      "progress: 181 0.005406479351222515\n",
      "progress: 182 0.005399819929152727\n",
      "progress: 183 0.005393024533987045\n",
      "progress: 184 0.005386723205447197\n",
      "progress: 185 0.005379796028137207\n",
      "progress: 186 0.0053734323009848595\n",
      "progress: 187 0.005366723518818617\n",
      "progress: 188 0.0053603677079081535\n",
      "progress: 189 0.0053538060747087\n",
      "progress: 190 0.005347388330847025\n",
      "progress: 191 0.005340904463082552\n",
      "progress: 192 0.005334424786269665\n",
      "progress: 193 0.005328227765858173\n",
      "progress: 194 0.005321616306900978\n",
      "progress: 195 0.0053154961206018925\n",
      "progress: 196 0.00530896196141839\n",
      "progress: 197 0.005302779376506805\n",
      "progress: 198 0.00529653113335371\n",
      "progress: 199 0.005290147848427296\n",
      "progress: 200 0.005283907055854797\n",
      "progress: 201 0.005277738906443119\n",
      "progress: 202 0.005271436180919409\n",
      "progress: 203 0.005265344865620136\n",
      "progress: 204 0.005259049125015736\n",
      "progress: 205 0.005252964794635773\n",
      "progress: 206 0.005246745888143778\n",
      "progress: 207 0.005240669008344412\n",
      "progress: 208 0.005234457086771727\n",
      "progress: 209 0.005228456109762192\n",
      "progress: 210 0.005222320556640625\n",
      "progress: 211 0.005216188728809357\n",
      "progress: 212 0.005210197996348143\n",
      "progress: 213 0.0052041420713067055\n",
      "progress: 214 0.0051980894058942795\n",
      "progress: 215 0.005192040931433439\n",
      "progress: 216 0.005186064168810844\n",
      "progress: 217 0.005179953295737505\n",
      "progress: 218 0.00517418934032321\n",
      "progress: 219 0.005167949013411999\n",
      "progress: 220 0.005162123125046492\n",
      "progress: 221 0.005156232044100761\n",
      "progress: 222 0.005150207318365574\n",
      "progress: 223 0.005144254770129919\n",
      "progress: 224 0.00513837393373251\n",
      "progress: 225 0.005132428370416164\n",
      "progress: 226 0.005126554518938065\n",
      "progress: 227 0.005120615474879742\n",
      "progress: 228 0.005114816129207611\n",
      "progress: 229 0.005108952522277832\n",
      "progress: 230 0.00510302372276783\n",
      "progress: 231 0.00509723462164402\n",
      "progress: 232 0.0050913807936012745\n",
      "progress: 233 0.005085598211735487\n",
      "progress: 234 0.005079751368612051\n",
      "progress: 235 0.005073907319456339\n",
      "progress: 236 0.005068202968686819\n",
      "progress: 237 0.005062365438789129\n",
      "progress: 238 0.005056599620729685\n",
      "progress: 239 0.005050769075751305\n",
      "progress: 240 0.0050450777634978294\n",
      "progress: 241 0.0050392537377774715\n",
      "progress: 242 0.005033500958234072\n",
      "progress: 243 0.005027818959206343\n",
      "progress: 244 0.005022140219807625\n",
      "progress: 245 0.005016262177377939\n",
      "progress: 246 0.005010724999010563\n",
      "progress: 247 0.005004786420613527\n",
      "progress: 248 0.004999322816729546\n",
      "progress: 249 0.004993592854589224\n",
      "progress: 250 0.004987799096852541\n",
      "progress: 251 0.0049822102300822735\n",
      "progress: 252 0.004976490046828985\n",
      "progress: 253 0.004970840644091368\n",
      "progress: 254 0.004965261556208134\n",
      "progress: 255 0.004959484096616507\n",
      "progress: 256 0.004954045172780752\n",
      "progress: 257 0.004948274232447147\n",
      "progress: 258 0.004942640662193298\n",
      "progress: 259 0.004937144462019205\n",
      "progress: 260 0.004931450355798006\n",
      "progress: 261 0.004925826098769903\n",
      "progress: 262 0.004920406267046928\n",
      "progress: 263 0.0049146548844873905\n",
      "progress: 264 0.004909174051135778\n",
      "progress: 265 0.004903496243059635\n",
      "progress: 266 0.004898088052868843\n",
      "progress: 267 0.004892483353614807\n",
      "progress: 268 0.004886881448328495\n",
      "progress: 269 0.004881349857896566\n",
      "progress: 270 0.004875887650996447\n",
      "progress: 271 0.004870228935033083\n",
      "progress: 272 0.004864772781729698\n",
      "progress: 273 0.004859320353716612\n",
      "progress: 274 0.004853737540543079\n",
      "progress: 275 0.004848357290029526\n",
      "progress: 276 0.004842714406549931\n",
      "progress: 277 0.004837340209633112\n",
      "progress: 278 0.004831770434975624\n",
      "progress: 279 0.0048264022916555405\n",
      "progress: 280 0.004820838570594788\n",
      "progress: 281 0.004815476480871439\n",
      "progress: 282 0.004809985402971506\n",
      "progress: 283 0.004804563242942095\n",
      "progress: 284 0.004799144342541695\n",
      "progress: 285 0.00479359645396471\n",
      "progress: 286 0.004788315389305353\n",
      "progress: 287 0.0047828396782279015\n",
      "progress: 288 0.004777367226779461\n",
      "progress: 289 0.004772029351443052\n",
      "progress: 290 0.004766628611832857\n",
      "progress: 291 0.0047612967900931835\n",
      "progress: 292 0.004755639471113682\n",
      "progress: 293 0.004750510677695274\n",
      "progress: 294 0.004745056852698326\n",
      "progress: 295 0.004739671479910612\n",
      "progress: 296 0.00473435502499342\n",
      "progress: 297 0.004728975705802441\n",
      "progress: 298 0.004723599646240473\n",
      "progress: 299 0.004718291573226452\n",
      "progress: 300 0.004712921567261219\n",
      "progress: 301 0.004707685671746731\n",
      "progress: 302 0.0047022560611367226\n",
      "progress: 303 0.0046971566043794155\n",
      "progress: 304 0.004691602662205696\n",
      "progress: 305 0.00468631274998188\n",
      "progress: 306 0.004681222140789032\n",
      "progress: 307 0.004675612319260836\n",
      "progress: 308 0.004670527298003435\n",
      "progress: 309 0.004665249492973089\n",
      "progress: 310 0.004659909754991531\n",
      "progress: 311 0.0046546380035579205\n",
      "progress: 312 0.004649369046092033\n",
      "progress: 313 0.004644233267754316\n",
      "progress: 314 0.0046389056369662285\n",
      "progress: 315 0.004633645992726088\n",
      "progress: 316 0.0046283891424536705\n",
      "progress: 317 0.0046232002787292\n",
      "progress: 318 0.004617949016392231\n",
      "progress: 319 0.004612766206264496\n",
      "progress: 320 0.004607585724443197\n",
      "progress: 321 0.004602279048413038\n",
      "progress: 322 0.004597039893269539\n",
      "progress: 323 0.004591933451592922\n",
      "progress: 324 0.004586700350046158\n",
      "progress: 325 0.0045815990306437016\n",
      "progress: 326 0.004576307255774736\n",
      "progress: 327 0.004571212455630302\n",
      "progress: 328 0.004566055256873369\n",
      "progress: 329 0.00456077279523015\n",
      "progress: 330 0.004555750638246536\n",
      "progress: 331 0.004550538025796413\n",
      "progress: 332 0.00454539293423295\n",
      "progress: 333 0.004540314897894859\n",
      "progress: 334 0.004535046871751547\n",
      "progress: 335 0.004530039150267839\n",
      "progress: 336 0.0045248414389789104\n",
      "progress: 337 0.004519838839769363\n",
      "progress: 338 0.004514647182077169\n",
      "progress: 339 0.004509586375206709\n",
      "progress: 340 0.004504464566707611\n",
      "progress: 341 0.004499409347772598\n",
      "progress: 342 0.004494293127208948\n",
      "progress: 343 0.00448924396187067\n",
      "progress: 344 0.004484197124838829\n",
      "progress: 345 0.004479089751839638\n",
      "progress: 346 0.00447398517280817\n",
      "progress: 347 0.004468947183340788\n",
      "progress: 348 0.0044638486579060555\n",
      "progress: 349 0.004458816256374121\n",
      "progress: 350 0.004453850444406271\n",
      "progress: 351 0.00444876030087471\n",
      "progress: 352 0.004443736746907234\n",
      "progress: 353 0.004438715986907482\n",
      "progress: 354 0.004433761350810528\n",
      "progress: 355 0.004428682383149862\n",
      "progress: 356 0.004423733800649643\n",
      "progress: 357 0.004418660886585712\n",
      "progress: 358 0.0044137174263596535\n",
      "progress: 359 0.004408776760101318\n",
      "progress: 360 0.004403649363666773\n",
      "progress: 361 0.004398777615278959\n",
      "progress: 362 0.004393845330923796\n",
      "progress: 363 0.004388789646327496\n",
      "progress: 364 0.00438386294990778\n",
      "progress: 365 0.004378939047455788\n",
      "progress: 366 0.004373955074697733\n",
      "progress: 367 0.0043691000901162624\n",
      "progress: 368 0.004363995511084795\n",
      "progress: 369 0.0043592085130512714\n",
      "progress: 370 0.0043541728518903255\n",
      "progress: 371 0.004349328577518463\n",
      "progress: 372 0.004344424232840538\n",
      "progress: 373 0.004339396953582764\n",
      "progress: 374 0.004334686789661646\n",
      "progress: 375 0.004329602234065533\n",
      "progress: 376 0.004324834328144789\n",
      "progress: 377 0.004319881089031696\n",
      "progress: 378 0.0043150559067726135\n",
      "progress: 379 0.004310171119868755\n",
      "progress: 380 0.004305289126932621\n",
      "progress: 381 0.004300409462302923\n",
      "progress: 382 0.004295532591640949\n",
      "progress: 383 0.004290783777832985\n",
      "progress: 384 0.00428578769788146\n",
      "progress: 385 0.004280981607735157\n",
      "progress: 386 0.004276178311556578\n",
      "progress: 387 0.004271315410733223\n",
      "progress: 388 0.004266517702490091\n",
      "progress: 389 0.004261659923940897\n",
      "progress: 390 0.004256867803633213\n",
      "progress: 391 0.004252015613019466\n",
      "progress: 392 0.004247290547937155\n",
      "progress: 393 0.004242444410920143\n",
      "progress: 394 0.00423766253516078\n",
      "progress: 395 0.004232821520417929\n",
      "progress: 396 0.0042281076312065125\n",
      "progress: 397 0.0042233336716890335\n",
      "progress: 398 0.004218501038849354\n",
      "progress: 399 0.00421373313292861\n",
      "progress: 400 0.004209029488265514\n",
      "progress: 401 0.004204266704618931\n",
      "progress: 402 0.004199568182229996\n",
      "progress: 403 0.004194687586277723\n",
      "progress: 404 0.0041900561191141605\n",
      "progress: 405 0.0041852425783872604\n",
      "progress: 406 0.004180554766207933\n",
      "progress: 407 0.00417586974799633\n",
      "progress: 408 0.004171064589172602\n",
      "progress: 409 0.004166384693235159\n",
      "progress: 410 0.00416170759126544\n",
      "progress: 411 0.00415697181597352\n",
      "progress: 412 0.004152299836277962\n",
      "progress: 413 0.00414756964892149\n",
      "progress: 414 0.004142964258790016\n",
      "progress: 415 0.0041382391937077045\n",
      "progress: 416 0.0041335164569318295\n",
      "progress: 417 0.0041289194487035275\n",
      "progress: 418 0.004124263301491737\n",
      "progress: 419 0.004119548946619034\n",
      "progress: 420 0.004114959388971329\n",
      "progress: 421 0.004110189154744148\n",
      "progress: 422 0.004105665720999241\n",
      "progress: 423 0.004101023077964783\n",
      "progress: 424 0.0040962607599794865\n",
      "progress: 425 0.004091806244105101\n",
      "progress: 426 0.004086988512426615\n",
      "progress: 427 0.004082599654793739\n",
      "progress: 428 0.004077726509422064\n",
      "progress: 429 0.004073342774063349\n",
      "progress: 430 0.004068596754223108\n",
      "progress: 431 0.004064096603542566\n",
      "progress: 432 0.0040594167076051235\n",
      "progress: 433 0.004054860677570105\n",
      "progress: 434 0.0040503679774701595\n",
      "progress: 435 0.004045635461807251\n",
      "progress: 436 0.004041087348014116\n",
      "progress: 437 0.004036602098494768\n",
      "progress: 438 0.004031998571008444\n",
      "progress: 439 0.004027457907795906\n",
      "progress: 440 0.004022920038551092\n",
      "progress: 441 0.004018324427306652\n",
      "progress: 442 0.0040137916803359985\n",
      "progress: 443 0.0040093217976391315\n",
      "progress: 444 0.004004733636975288\n",
      "progress: 445 0.004000268876552582\n",
      "progress: 446 0.003995686303824186\n",
      "progress: 447 0.00399122666567564\n",
      "progress: 448 0.003986709285527468\n",
      "progress: 449 0.003982194233685732\n",
      "progress: 450 0.003977621905505657\n",
      "progress: 451 0.0039731720462441444\n",
      "progress: 452 0.003968664910644293\n",
      "progress: 453 0.0039642201736569405\n",
      "progress: 454 0.003959718160331249\n",
      "progress: 455 0.003955278545618057\n",
      "progress: 456 0.003950721584260464\n",
      "progress: 457 0.003946287091821432\n",
      "progress: 458 0.003941854927688837\n",
      "progress: 459 0.003937425557523966\n",
      "progress: 460 0.003932878840714693\n",
      "progress: 461 0.003928514197468758\n",
      "progress: 462 0.003924092277884483\n",
      "progress: 463 0.003919612616300583\n",
      "progress: 464 0.003915195818990469\n",
      "progress: 465 0.003910840954631567\n",
      "progress: 466 0.003906309604644775\n",
      "progress: 467 0.0039020192343741655\n",
      "progress: 468 0.0038974930066615343\n",
      "progress: 469 0.003893207525834441\n",
      "progress: 470 0.0038886864203959703\n",
      "progress: 471 0.003884405829012394\n",
      "progress: 472 0.0038799492176622152\n",
      "progress: 473 0.0038755545392632484\n",
      "progress: 474 0.0038712217938154936\n",
      "progress: 475 0.0038668320048600435\n",
      "progress: 476 0.0038625041488558054\n",
      "progress: 477 0.003858060110360384\n",
      "progress: 478 0.0038537371437996626\n",
      "progress: 479 0.0038493573665618896\n",
      "progress: 480 0.003845039289444685\n",
      "progress: 481 0.003840723540633917\n",
      "progress: 482 0.0038362331688404083\n",
      "progress: 483 0.0038320994935929775\n",
      "progress: 484 0.0038276140112429857\n",
      "progress: 485 0.003823308041319251\n",
      "progress: 486 0.003819063538685441\n",
      "progress: 487 0.003814762458205223\n",
      "progress: 488 0.003810405032709241\n",
      "progress: 489 0.0038060499355196953\n",
      "progress: 490 0.003801873652264476\n",
      "progress: 491 0.003797464771196246\n",
      "progress: 492 0.0037931171245872974\n",
      "progress: 493 0.003789006732404232\n",
      "progress: 494 0.0037845466285943985\n",
      "progress: 495 0.003780440893024206\n",
      "progress: 496 0.003776103025302291\n",
      "progress: 497 0.003771826159209013\n",
      "progress: 498 0.0037674931809306145\n",
      "progress: 499 0.003763338318094611\n",
      "progress: 500 0.0037590102292597294\n",
      "progress: 501 0.003754801582545042\n",
      "progress: 502 0.0037505952641367912\n",
      "progress: 503 0.0037462746258825064\n",
      "progress: 504 0.0037420729640871286\n",
      "progress: 505 0.003737873863428831\n",
      "progress: 506 0.003733618650585413\n",
      "progress: 507 0.0037294242065399885\n",
      "progress: 508 0.003725173883140087\n",
      "progress: 509 0.0037209840957075357\n",
      "progress: 510 0.0037167968694120646\n",
      "progress: 511 0.003712495556101203\n",
      "progress: 512 0.0037084873765707016\n",
      "progress: 513 0.0037041327450424433\n",
      "progress: 514 0.0037000710144639015\n",
      "progress: 515 0.003695837454870343\n",
      "progress: 516 0.0036916641984134912\n",
      "progress: 517 0.0036874355282634497\n",
      "progress: 518 0.0036833828780800104\n",
      "progress: 519 0.0036791011225432158\n",
      "progress: 520 0.0036749951541423798\n",
      "progress: 521 0.003670776030048728\n",
      "progress: 522 0.0036667324602603912\n",
      "progress: 523 0.0036625757347792387\n",
      "progress: 524 0.0036584215704351664\n",
      "progress: 525 0.003654269501566887\n",
      "progress: 526 0.003650119761005044\n",
      "progress: 527 0.00364608783274889\n",
      "progress: 528 0.003641827730461955\n",
      "progress: 529 0.003637857735157013\n",
      "progress: 530 0.003633717307820916\n",
      "progress: 531 0.003629521932452917\n",
      "progress: 532 0.0036255011800676584\n",
      "progress: 533 0.003621310694143176\n",
      "progress: 534 0.003617294365540147\n",
      "progress: 535 0.0036131658125668764\n",
      "progress: 536 0.0036091541405767202\n",
      "progress: 537 0.003604972967877984\n",
      "progress: 538 0.00360102322883904\n",
      "progress: 539 0.003596789436414838\n",
      "progress: 540 0.003592901397496462\n",
      "progress: 541 0.003588786581531167\n",
      "progress: 542 0.0035846743267029524\n",
      "progress: 543 0.0035807357635349035\n",
      "progress: 544 0.003576570888981223\n",
      "progress: 545 0.0035725797060877085\n",
      "progress: 546 0.003568533807992935\n",
      "progress: 547 0.00356454704888165\n",
      "progress: 548 0.003560448531061411\n",
      "progress: 549 0.0035564093850553036\n",
      "progress: 550 0.0035524293780326843\n",
      "progress: 551 0.003548508509993553\n",
      "progress: 552 0.0035444193053990602\n",
      "progress: 553 0.003540446050465107\n",
      "progress: 554 0.0035364751238375902\n",
      "progress: 555 0.003532392904162407\n",
      "progress: 556 0.0035284264013171196\n",
      "progress: 557 0.003524461993947625\n",
      "progress: 558 0.0035203867591917515\n",
      "progress: 559 0.003516540164127946\n",
      "progress: 560 0.0035124695859849453\n",
      "progress: 561 0.0035085706040263176\n",
      "progress: 562 0.0035045610275119543\n",
      "progress: 563 0.0035006667021661997\n",
      "progress: 564 0.0034966052044183016\n",
      "progress: 565 0.0034927150700241327\n",
      "progress: 566 0.003488770918920636\n",
      "progress: 567 0.003484829096123576\n",
      "progress: 568 0.003480889368802309\n",
      "progress: 569 0.0034770641941577196\n",
      "progress: 570 0.003472904209047556\n",
      "progress: 571 0.0034691959153860807\n",
      "progress: 572 0.0034651525784283876\n",
      "progress: 573 0.003461224026978016\n",
      "progress: 574 0.0034573536831885576\n",
      "progress: 575 0.003453485667705536\n",
      "progress: 576 0.0034495077561587095\n",
      "progress: 577 0.0034456439316272736\n",
      "progress: 578 0.003441838314756751\n",
      "progress: 579 0.0034378671552985907\n",
      "progress: 580 0.0034339539706707\n",
      "progress: 581 0.003430098993703723\n",
      "progress: 582 0.0034261904656887054\n",
      "progress: 583 0.003422339679673314\n",
      "progress: 584 0.003418547101318836\n",
      "progress: 585 0.003414589213207364\n",
      "progress: 586 0.003410800825804472\n",
      "progress: 587 0.003406903240829706\n",
      "progress: 588 0.0034030633978545666\n",
      "progress: 589 0.0033991702366620302\n",
      "progress: 590 0.0033953902311623096\n",
      "progress: 591 0.0033915569074451923\n",
      "progress: 592 0.0033877259120345116\n",
      "progress: 593 0.0033838413655757904\n",
      "progress: 594 0.0033800702076405287\n",
      "progress: 595 0.0033762454986572266\n",
      "progress: 596 0.003372423117980361\n",
      "progress: 597 0.0033685474190860987\n",
      "progress: 598 0.0033648398239165545\n",
      "progress: 599 0.003361023962497711\n",
      "progress: 600 0.003357154782861471\n",
      "progress: 601 0.0033534537069499493\n",
      "progress: 602 0.0033495889510959387\n",
      "progress: 603 0.003345836652442813\n",
      "progress: 604 0.0033420315012335777\n",
      "progress: 605 0.0033383388072252274\n",
      "progress: 606 0.003334482666105032\n",
      "progress: 607 0.003330684034153819\n",
      "progress: 608 0.0033269973937422037\n",
      "progress: 609 0.0033232029527425766\n",
      "progress: 610 0.0033194106072187424\n",
      "progress: 611 0.0033157302532345057\n",
      "progress: 612 0.003311942331492901\n",
      "progress: 613 0.0033082112204283476\n",
      "progress: 614 0.0033044274896383286\n",
      "progress: 615 0.0033007008023560047\n",
      "progress: 616 0.00329697597771883\n",
      "progress: 617 0.0032933081965893507\n",
      "progress: 618 0.003289532847702503\n",
      "progress: 619 0.0032858692575246096\n",
      "progress: 620 0.0032820983324199915\n",
      "progress: 621 0.003278384217992425\n",
      "progress: 622 0.0032747266814112663\n",
      "progress: 623 0.0032710167579352856\n",
      "progress: 624 0.003267308697104454\n",
      "progress: 625 0.003263602964580059\n",
      "progress: 626 0.003259953809902072\n",
      "progress: 627 0.003256252035498619\n",
      "progress: 628 0.0032525525894016027\n",
      "progress: 629 0.0032489094883203506\n",
      "progress: 630 0.00324521423317492\n",
      "progress: 631 0.0032415210735052824\n",
      "progress: 632 0.0032378840260207653\n",
      "progress: 633 0.003234303556382656\n",
      "progress: 634 0.003230562200769782\n",
      "progress: 635 0.0032269316725432873\n",
      "progress: 636 0.0032233030069619417\n",
      "progress: 637 0.0032196762040257454\n",
      "progress: 638 0.0032159434631466866\n",
      "progress: 639 0.0032123751007020473\n",
      "progress: 640 0.0032087545841932297\n",
      "progress: 641 0.003205136163160205\n",
      "progress: 642 0.0032014658208936453\n",
      "progress: 643 0.0031979053746908903\n",
      "progress: 644 0.0031942392233759165\n",
      "progress: 645 0.0031906289514154196\n",
      "progress: 646 0.0031870207749307156\n",
      "progress: 647 0.0031834684778004885\n",
      "progress: 648 0.0031798104755580425\n",
      "progress: 649 0.0031762621365487576\n",
      "progress: 650 0.0031726621091365814\n",
      "progress: 651 0.003169064177200198\n",
      "progress: 652 0.003165521891787648\n",
      "progress: 653 0.003161874134093523\n",
      "progress: 654 0.003158335806801915\n",
      "progress: 655 0.0031547995749861\n",
      "progress: 656 0.003151211654767394\n",
      "progress: 657 0.003147625830024481\n",
      "progress: 658 0.003144095651805401\n",
      "progress: 659 0.0031405137851834297\n",
      "progress: 660 0.0031370408833026886\n",
      "progress: 661 0.003133409656584263\n",
      "progress: 662 0.003129887394607067\n",
      "progress: 663 0.0031263669952750206\n",
      "progress: 664 0.003122848691418767\n",
      "progress: 665 0.0031193322502076626\n",
      "progress: 666 0.003115817904472351\n",
      "progress: 667 0.003112305421382189\n",
      "progress: 668 0.0031086886301636696\n",
      "progress: 669 0.0031052865087985992\n",
      "progress: 670 0.003101726993918419\n",
      "progress: 671 0.003098222427070141\n",
      "progress: 672 0.0030947199556976557\n",
      "progress: 673 0.003091272432357073\n",
      "progress: 674 0.0030876679811626673\n",
      "progress: 675 0.0030842244159430265\n",
      "progress: 676 0.003080782713368535\n",
      "progress: 677 0.003077237168326974\n",
      "progress: 678 0.0030737994238734245\n",
      "progress: 679 0.0030703635420650244\n",
      "progress: 680 0.0030668240506201982\n",
      "progress: 681 0.00306339212693274\n",
      "progress: 682 0.003059856593608856\n",
      "progress: 683 0.0030565341003239155\n",
      "progress: 684 0.0030530025251209736\n",
      "progress: 685 0.0030495785176753998\n",
      "progress: 686 0.0030462087597697973\n",
      "progress: 687 0.0030426306184381247\n",
      "progress: 688 0.00303931743837893\n",
      "progress: 689 0.0030357432551681995\n",
      "progress: 690 0.0030323814135044813\n",
      "progress: 691 0.0030289688147604465\n",
      "progress: 692 0.003025558078661561\n",
      "progress: 693 0.0030220970511436462\n",
      "progress: 694 0.003018742660060525\n",
      "progress: 695 0.0030152853578329086\n",
      "progress: 696 0.003011934692040086\n",
      "progress: 697 0.0030084289610385895\n",
      "progress: 698 0.0030051867943257093\n",
      "progress: 699 0.0030016328673809767\n",
      "progress: 700 0.002998342039063573\n",
      "progress: 701 0.002994844224303961\n",
      "progress: 702 0.002991504967212677\n",
      "progress: 703 0.0029881675727665424\n",
      "progress: 704 0.0029846758116036654\n",
      "progress: 705 0.002981446450576186\n",
      "progress: 706 0.002978010568767786\n",
      "progress: 707 0.0029746287036687136\n",
      "progress: 708 0.0029713527765125036\n",
      "progress: 709 0.002967922715470195\n",
      "progress: 710 0.0029645985923707485\n",
      "progress: 711 0.0029612244106829166\n",
      "progress: 712 0.002957904012873769\n",
      "progress: 713 0.00295458547770977\n",
      "progress: 714 0.00295111327432096\n",
      "progress: 715 0.002947902074083686\n",
      "progress: 716 0.002944537438452244\n",
      "progress: 717 0.002941174665465951\n",
      "progress: 718 0.0029378137551248074\n",
      "progress: 719 0.0029346097726374865\n",
      "progress: 720 0.002931252820417285\n",
      "progress: 721 0.002927897498011589\n",
      "progress: 722 0.0029246474150568247\n",
      "progress: 723 0.0029213475063443184\n",
      "progress: 724 0.002917998004704714\n",
      "progress: 725 0.0029147020541131496\n",
      "progress: 726 0.002911407733336091\n",
      "progress: 727 0.0029081152752041817\n",
      "progress: 728 0.002904824912548065\n",
      "progress: 729 0.0029015361797064543\n",
      "progress: 730 0.00289830076508224\n",
      "progress: 731 0.0028950157575309277\n",
      "progress: 732 0.002891732845455408\n",
      "progress: 733 0.002888451563194394\n",
      "progress: 734 0.002885223366320133\n",
      "progress: 735 0.002881894586607814\n",
      "progress: 736 0.0028786701150238514\n",
      "progress: 737 0.002875447506085038\n",
      "progress: 738 0.0028721755370497704\n",
      "progress: 739 0.0028689054306596518\n",
      "progress: 740 0.0028657393995672464\n",
      "progress: 741 0.0028623708058148623\n",
      "progress: 742 0.002859310247004032\n",
      "progress: 743 0.00285594561137259\n",
      "progress: 744 0.0028527865651994944\n",
      "progress: 745 0.002849527634680271\n",
      "progress: 746 0.0028463720809668303\n",
      "progress: 747 0.002843116642907262\n",
      "progress: 748 0.0028399648144841194\n",
      "progress: 749 0.0028367131017148495\n",
      "progress: 750 0.0028334632515907288\n",
      "progress: 751 0.0028303167782723904\n",
      "progress: 752 0.002827070653438568\n",
      "progress: 753 0.0028239276725798845\n",
      "progress: 754 0.0028207863215357065\n",
      "progress: 755 0.0028174445033073425\n",
      "progress: 756 0.0028144081588834524\n",
      "progress: 757 0.002811120357364416\n",
      "progress: 758 0.002808087505400181\n",
      "progress: 759 0.002804803429171443\n",
      "progress: 760 0.002801622496917844\n",
      "progress: 761 0.002798493718728423\n",
      "progress: 762 0.0027953162789344788\n",
      "progress: 763 0.002792190993204713\n",
      "progress: 764 0.002788966754451394\n",
      "progress: 765 0.002785895485430956\n",
      "progress: 766 0.002782725030556321\n",
      "progress: 767 0.0027795566711574793\n",
      "progress: 768 0.0027764402329921722\n",
      "progress: 769 0.002773275366052985\n",
      "progress: 770 0.0027701121289283037\n",
      "progress: 771 0.0027670511044561863\n",
      "progress: 772 0.0027638915926218033\n",
      "progress: 773 0.0027607339434325695\n",
      "progress: 774 0.002757728099822998\n",
      "progress: 775 0.002754473825916648\n",
      "progress: 776 0.0027514714747667313\n",
      "progress: 777 0.0027483708690851927\n",
      "progress: 778 0.0027451221831142902\n",
      "progress: 779 0.0027421750128269196\n",
      "progress: 780 0.002738979645073414\n",
      "progress: 781 0.0027359360828995705\n",
      "progress: 782 0.002732844091951847\n",
      "progress: 783 0.002729704137891531\n",
      "progress: 784 0.002726615872234106\n",
      "progress: 785 0.0027235790621489286\n",
      "progress: 786 0.002720444230362773\n",
      "progress: 787 0.0027174607384949923\n",
      "progress: 788 0.002714329631999135\n",
      "progress: 789 0.0027112995740026236\n",
      "progress: 790 0.002708171959966421\n",
      "progress: 791 0.0027051949873566628\n",
      "progress: 792 0.002702120691537857\n",
      "progress: 793 0.0026989984326064587\n",
      "progress: 794 0.0026959769893437624\n",
      "progress: 795 0.002692907815799117\n",
      "progress: 796 0.0026899392250925303\n",
      "progress: 797 0.0026868735440075397\n",
      "progress: 798 0.0026838588528335094\n",
      "progress: 799 0.00268079643137753\n",
      "progress: 800 0.002677686745300889\n",
      "progress: 801 0.0026747758965939283\n",
      "progress: 802 0.002671718830242753\n",
      "progress: 803 0.0026686633937060833\n",
      "progress: 804 0.0026656589470803738\n",
      "progress: 805 0.0026627054903656244\n",
      "progress: 806 0.0026596554089337587\n",
      "progress: 807 0.0026566560845822096\n",
      "progress: 808 0.002653658390045166\n",
      "progress: 809 0.0026506625581532717\n",
      "progress: 810 0.002647668356075883\n",
      "progress: 811 0.002644724678248167\n",
      "progress: 812 0.002641635946929455\n",
      "progress: 813 0.002638744655996561\n",
      "progress: 814 0.002635708311572671\n",
      "progress: 815 0.002632771385833621\n",
      "progress: 816 0.0026297385338693857\n",
      "progress: 817 0.002626804867759347\n",
      "progress: 818 0.00262382416985929\n",
      "progress: 819 0.002620893996208906\n",
      "progress: 820 0.002617867896333337\n",
      "progress: 821 0.0026149896439164877\n",
      "progress: 822 0.002611967036500573\n",
      "progress: 823 0.0026090433821082115\n",
      "progress: 824 0.0026060729287564754\n",
      "progress: 825 0.002603152533993125\n",
      "progress: 826 0.0026001366786658764\n",
      "progress: 827 0.0025973168667405844\n",
      "progress: 828 0.0025943045038729906\n",
      "progress: 829 0.002591390861198306\n",
      "progress: 830 0.002588527277112007\n",
      "progress: 831 0.00258551980368793\n",
      "progress: 832 0.0025826594792306423\n",
      "progress: 833 0.0025797039270401\n",
      "progress: 834 0.002576798666268587\n",
      "progress: 835 0.002573894802480936\n",
      "progress: 836 0.002570895943790674\n",
      "progress: 837 0.0025681403931230307\n",
      "progress: 838 0.0025650965981185436\n",
      "progress: 839 0.0025623440742492676\n",
      "progress: 840 0.0025593037717044353\n",
      "progress: 841 0.002556506311520934\n",
      "progress: 842 0.0025535656604915857\n",
      "progress: 843 0.002550675068050623\n",
      "progress: 844 0.0025478340685367584\n",
      "progress: 845 0.0025448985397815704\n",
      "progress: 846 0.0025421089958399534\n",
      "progress: 847 0.0025391285307705402\n",
      "progress: 848 0.0025363422464579344\n",
      "progress: 849 0.002533509163185954\n",
      "progress: 850 0.002530534053221345\n",
      "progress: 851 0.0025277521926909685\n",
      "progress: 852 0.002524923998862505\n",
      "progress: 853 0.0025220017414540052\n",
      "progress: 854 0.002519129076972604\n",
      "progress: 855 0.0025164014659821987\n",
      "progress: 856 0.002513436134904623\n",
      "progress: 857 0.0025106638204306364\n",
      "progress: 858 0.0025077499449253082\n",
      "progress: 859 0.002504980657249689\n",
      "progress: 860 0.0025021175388246775\n",
      "progress: 861 0.002499256283044815\n",
      "progress: 862 0.002496491651982069\n",
      "progress: 863 0.002493633423000574\n",
      "progress: 864 0.0024907770566642284\n",
      "progress: 865 0.0024880648124963045\n",
      "progress: 866 0.0024851637426763773\n",
      "progress: 867 0.002482407260686159\n",
      "progress: 868 0.0024796519428491592\n",
      "progress: 869 0.0024767559953033924\n",
      "progress: 870 0.002473956672474742\n",
      "progress: 871 0.0024712062440812588\n",
      "progress: 872 0.0024684572126716375\n",
      "progress: 873 0.002465567784383893\n",
      "progress: 874 0.002462822012603283\n",
      "progress: 875 0.0024600776378065348\n",
      "progress: 876 0.0024572876282036304\n",
      "progress: 877 0.0024544992484152317\n",
      "progress: 878 0.0024517124984413385\n",
      "progress: 879 0.0024489271454513073\n",
      "progress: 880 0.002446237951517105\n",
      "progress: 881 0.0024433142971247435\n",
      "progress: 882 0.002440675161778927\n",
      "progress: 883 0.002437943359836936\n",
      "progress: 884 0.002435118891298771\n",
      "progress: 885 0.0024323901161551476\n",
      "progress: 886 0.0024296629708260298\n",
      "progress: 887 0.002426937222480774\n",
      "progress: 888 0.0024241190403699875\n",
      "progress: 889 0.0024214903824031353\n",
      "progress: 890 0.002418628428131342\n",
      "progress: 891 0.0024160027969628572\n",
      "progress: 892 0.002413191134110093\n",
      "progress: 893 0.002410521497949958\n",
      "progress: 894 0.00240780645981431\n",
      "progress: 895 0.0024050462525337934\n",
      "progress: 896 0.002402334474027157\n",
      "progress: 897 0.0023996708914637566\n",
      "progress: 898 0.002396915340796113\n",
      "progress: 899 0.002394207986071706\n",
      "progress: 900 0.002391502261161804\n",
      "progress: 901 0.002388798166066408\n",
      "progress: 902 0.002386095467954874\n",
      "progress: 903 0.002383394166827202\n",
      "progress: 904 0.002380741061642766\n",
      "progress: 905 0.002377950120717287\n",
      "progress: 906 0.0023753929417580366\n",
      "progress: 907 0.002372605027630925\n",
      "progress: 908 0.0023699577432125807\n",
      "progress: 909 0.0023672657553106546\n",
      "progress: 910 0.0023646217305213213\n",
      "progress: 911 0.00236197910271585\n",
      "progress: 912 0.0023591991048306227\n",
      "progress: 913 0.0023566982708871365\n",
      "progress: 914 0.0023539212998002768\n",
      "progress: 915 0.0023512847255915403\n",
      "progress: 916 0.002348649548366666\n",
      "progress: 917 0.00234596966765821\n",
      "progress: 918 0.002343337517231703\n",
      "progress: 919 0.0023406606633216143\n",
      "progress: 920 0.0023379854392260313\n",
      "progress: 921 0.0023354499135166407\n",
      "progress: 922 0.002332731382921338\n",
      "progress: 923 0.002330106683075428\n",
      "progress: 924 0.00232748338021338\n",
      "progress: 925 0.0023248617071658373\n",
      "progress: 926 0.002322195563465357\n",
      "progress: 927 0.002319622552022338\n",
      "progress: 928 0.0023169133346527815\n",
      "progress: 929 0.0023143894504755735\n",
      "progress: 930 0.0023117291275411844\n",
      "progress: 931 0.0023091163020581007\n",
      "progress: 932 0.002306504873558879\n",
      "progress: 933 0.002303940709680319\n",
      "progress: 934 0.0023012864403426647\n",
      "progress: 935 0.002298725303262472\n",
      "progress: 936 0.0022960740607231855\n",
      "progress: 937 0.002293561352416873\n",
      "progress: 938 0.002290913136675954\n",
      "progress: 939 0.002288403222337365\n",
      "progress: 940 0.0022857123985886574\n",
      "progress: 941 0.0022832052782177925\n",
      "progress: 942 0.002280608518049121\n",
      "progress: 943 0.0022779679857194424\n",
      "progress: 944 0.0022755106911063194\n",
      "progress: 945 0.0022728273179382086\n",
      "progress: 946 0.002270327415317297\n",
      "progress: 947 0.00226769270375371\n",
      "progress: 948 0.002265195595100522\n",
      "progress: 949 0.0022625636775046587\n",
      "progress: 950 0.002260069362819195\n",
      "progress: 951 0.0022575766779482365\n",
      "progress: 952 0.002254858613014221\n",
      "progress: 953 0.0022524590604007244\n",
      "progress: 954 0.0022498348262161016\n",
      "progress: 955 0.002247392665594816\n",
      "progress: 956 0.0022447260562330484\n",
      "progress: 957 0.002242286689579487\n",
      "progress: 958 0.0022396682761609554\n",
      "progress: 959 0.0022371415980160236\n",
      "progress: 960 0.0022346614859998226\n",
      "progress: 961 0.002232092432677746\n",
      "progress: 962 0.0022296151146292686\n",
      "progress: 963 0.0022270940244197845\n",
      "progress: 964 0.002224484458565712\n",
      "progress: 965 0.002222146140411496\n",
      "progress: 966 0.002219449495896697\n",
      "progress: 967 0.00221706903539598\n",
      "progress: 968 0.002214510226622224\n",
      "progress: 969 0.0022120424546301365\n",
      "progress: 970 0.0022095313761383295\n",
      "progress: 971 0.0022070216946303844\n",
      "progress: 972 0.0022044687066227198\n",
      "progress: 973 0.002202096162363887\n",
      "progress: 974 0.0021995012648403645\n",
      "progress: 975 0.002197086811065674\n",
      "progress: 976 0.00219462881796062\n",
      "progress: 977 0.0021920830477029085\n",
      "progress: 978 0.002189628081396222\n",
      "progress: 979 0.002187174279242754\n",
      "progress: 980 0.0021846326999366283\n",
      "progress: 981 0.0021822263952344656\n",
      "progress: 982 0.0021797323133796453\n",
      "progress: 983 0.002177284099161625\n",
      "progress: 984 0.0021748372819274664\n",
      "progress: 985 0.002172347391024232\n",
      "progress: 986 0.002169992309063673\n",
      "progress: 987 0.0021674162708222866\n",
      "progress: 988 0.0021650195121765137\n",
      "progress: 989 0.002162623917683959\n",
      "progress: 990 0.0021600525360554457\n",
      "progress: 991 0.002157659735530615\n",
      "progress: 992 0.002155223861336708\n",
      "progress: 993 0.002152833854779601\n",
      "progress: 994 0.0021503122989088297\n",
      "progress: 995 0.0021480133291333914\n",
      "progress: 996 0.0021454505622386932\n",
      "progress: 997 0.002143109915778041\n",
      "progress: 998 0.0021406824234873056\n",
      "progress: 999 0.0021382563281804323\n",
      "predict (after training) 4 8.325754165649414\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYgAAAEGCAYAAAB/+QKOAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuNCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8QVMy6AAAACXBIWXMAAAsTAAALEwEAmpwYAAAWo0lEQVR4nO3df7RlZX3f8fdn5s6o4CgSrgQGdDClrKIrILklUqLFEClMWY5tiUKiEkPXxCzs0rarCdQ0aftX28S0KhQyFSI0BDQqhmVGgdAUJEuFO5Qfg4gMiGUcwlyl8iOoMDPf/nH2zJxz777Dncvsc+beeb/WOuvs/ewf53nOnbmf++xn/0hVIUnSdEtGXQFJ0v7JgJAktTIgJEmtDAhJUisDQpLUamzUFdiXDjvssFq1atWoqyFJC8aGDRu+X1XjbcsWVUCsWrWKycnJUVdDkhaMJN+dbZmHmCRJrQwISVIrA0KS1MqAkCS1MiAkSa0MCElSKwNCktTK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YHNVfaOZ/xy9wFjMbf4l4DtVNVVVLwBfAP4Bi7vNO+1tGzc309PL5+RAD4g7gWOTHJNkOXAucMOI67RPNGcqXAE8UFV/2LfoBuD8Zvp84M/7ys9N8rIkxwDH0hvcWjCq6uKqOqqqVtH7Wf6vqnovi7vNfwM8luS4puh04Jss4jbTO7T0liQHNf/OT6c3xraY27zTXrWxOQz1TJK3NN/V+/u2eXGjHqkf9QtYTe8Mn4eBj466PvuwXb9Aryt5L3B381oN/BRwC/BQ835o3zYfbb6HB9mLMx32xxdwGrvPYlrUbQZOBCabn/UXgdccAG3+D8C3gI3A/6R39s6iajNwLb0xlhfo9QQumE8bgYnme3oYuITmDhpzeXmrDUlSqwP9EJMkaRYGhCSplQEhSWplQEiSWhkQkqRWBoS0H0hy2s67z0r7CwNCktTKgJD2QpL3Jrkjyd1J/qh59sSzST6W5K4ktyQZb9Y9McnXk9yb5Pqd9+5P8neS/GWSe5ptfqbZ/Sv7nutwzV7dt1/qgAEhzVGSvwe8Bzi1qk4EtgO/ChwM3FVVJwG3Ar/XbHI18NtV9bPAfX3l1wCXVtUJ9O4h9HhT/mbgI/Tu7f8GeveWkkZmbNQVkBaQ04GfA+5s/rh/Bb2bpe0APtOs8yfAF5K8Gjikqm5tyq8C/izJCmBlVV0PUFU/Bmj2d0dVbW7m7wZWAbd33ippFgaENHcBrqqqiwcKk383bb093b9mT4eNftI3vR3/f2rEPMQkzd0twDlJXgu7ng/8enr/j85p1vkV4Paqegr4f0ne2pS/D7i1es/k2JzkXc0+XpbkoGE2Qpor/0KR5qiqvpnkd4Cbkiyhd5fNC+k9pOeNSTYAT9Ebp4De7ZgvbwLgEeADTfn7gD9K8h+bffzyEJshzZl3c5VeoiTPVtUrR10PaV/zEJMkqZU9CElSK3sQkqRWBoQkqZUBIUlqZUBIkloZEJKkVv8fuxtiLCI2eAEAAAAASUVORK5CYII=",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "import os\n",
    "os.environ[\"KMP_DUPLICATE_LIB_OK\"]=\"TRUE\"\n",
    "import torch \n",
    "import matplotlib.pyplot as plt\n",
    "\n",
    "x_data = [1.0, 2.0, 3.0]\n",
    "y_data = [2.0, 4.0, 6.0]\n",
    "alpha = 0.01\n",
    "w1 = torch.Tensor([1.0])\n",
    "w1.requires_grad = True  # 需要计算梯度\n",
    "w2 = torch.Tensor([1.0])\n",
    "w2.requires_grad = True \n",
    "b = torch.Tensor([1.0])\n",
    "b.requires_grad = True \n",
    "\n",
    "def forward(x_val):\n",
    "    return (x_val**2)*w1 + x_val*w2 + b \n",
    "\n",
    "\n",
    "def loss(x_val, y_val):\n",
    "    y_hat = forward(x_val)\n",
    "    return (y_hat - y_val) ** 2\n",
    "\n",
    "\n",
    "epoch_list = []\n",
    "cost_list = []\n",
    "for epoch in range(1000):\n",
    "    # 随机梯度下降\n",
    "    for x, y in zip(x_data, y_data):\n",
    "        l = loss(x, y)\n",
    "        l.backward()\n",
    "        # print('\\t grad:', x, y, w.grad.item())\n",
    "        w1.data = w1.data - alpha * w1.grad.data\n",
    "        w2.data = w2.data - alpha * w2.grad.data\n",
    "        b.data = b.data - alpha * b.grad.data\n",
    "        w1.grad.data.zero_()\n",
    "        w2.grad.data.zero_()\n",
    "        b.grad.data.zero_()\n",
    "    epoch_list.append(epoch)\n",
    "    cost_list.append(l.item())\n",
    "    print('progress:', epoch, l.item())  # 取出loss使用l.item，不要直接使用l（l是tensor会构建计算图）\n",
    "print(\"predict (after training)\", 4, forward(4).item())\n",
    "plt.plot(epoch_list, cost_list)\n",
    "plt.ylabel('loss')\n",
    "plt.xlabel('epoch')\n",
    "plt.show()\n"
   ]
  }
 ],
 "metadata": {
  "interpreter": {
   "hash": "44143c5ac5f3ceb8e37c69c3af73325ae55d21292b2c7b54871fd886482dde4c"
  },
  "kernelspec": {
   "display_name": "Python 3.6.13 ('pytorch')",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.13"
  },
  "orig_nbformat": 4
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
